package com.supkong.prototype.deep;

/**
 * @author Kong
 * @date 2019/01/02
 * describe:
 */
public class Test {
    public static void main(String[] args) {

        //copy方式深拷贝
        Apple apple = new Apple();
        apple.setName("123455");
        Apple newApple = apple.copy(apple);
        System.out.println(apple.getIPhone() == newApple.getIPhone());
        System.out.println("-------------");
        //cloneable io流深拷贝
        try {
            Apple deepApple = (Apple) apple.clone();
            System.out.println(apple.getIPhone() == deepApple.getIPhone());
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
    }
}
